/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vnc;

import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;

/**
 *
 * @author javaking
 */
public class SaveConnData {
     private String photos = "fileconn.dir.photos";
        private  String path;
    public SaveConnData( String Host ,String Password){

        try {
            path = System.getProperty(photos);
            String url = path + "Data.txt";
            String string=Host+"|"+Password+"*";
            byte data[] = string.getBytes();
            FileConnection fconn = (FileConnection)Connector.open(url, Connector.READ_WRITE);
            if (!fconn.exists()) {
                fconn.create();
            }
            OutputStream ops = fconn.openOutputStream();
            ops.write(data);
            ops.close();
            fconn.close();
        }
        catch (IOException ioe) {
            System.out.println("IOException: "+ioe.getMessage());
        }
        catch (SecurityException se) {
            System.out.println("Security exception:" + se.getMessage());
        }


    }



}
